package com.example.rule.core;

import java.math.BigDecimal;
import java.time.ZonedDateTime;

/**
 * @author Jason - Chusifeng
 * @version 1.0.0
 * @ClassName Rule.java
 * @PackageName com\welab\vb\payment\transaction\rule\core\Rule.java
 * @Description 抽象规则父类
 * @createTime 2022年10月10日 10:48:42
 */
public interface Rule extends Comparable<Rule>{
    /**
     * Default rule name.
     */
    String DEFAULT_NAME = "rule";

    /**
     * Default rule description.
     */
    String DEFAULT_DESCRIPTION = "description";

    /**
     * Default rule priority.
     */
    int DEFAULT_PRIORITY = Integer.MAX_VALUE - 1;

    /**
     * createTime
     */
    ZonedDateTime NOW = ZonedDateTime.now();
    /**
     * Getter for rule name.
     * @return the rule name
     */
    default String getName() {
        return DEFAULT_NAME;
    }

    /**
     * Getter for rule description.
     * @return rule description
     */
    default String getDescription() {
        return DEFAULT_DESCRIPTION;
    }

    /**
     * Getter for rule priority.
     * @return rule priority
     */
    default int getPriority() {
        return DEFAULT_PRIORITY;
    }

    default ZonedDateTime getCreateTime() {return NOW;}

    /**
     *
    */
    boolean evaluate(Facts facts);

    /**
     */
    BigDecimal execute(Facts facts) throws Exception;
}
